import sys
sys.path.append(r'code')
from real.ml_reg.strage.open_order import Pos_make_rank_thred_open
from real.email_test import is_trade_day
import os
import operator
import numpy as np
import argparse

#basic
parser = argparse.ArgumentParser(description='ml_training structure')
parser.add_argument('--result_root', type=str,  default='dl_test', help='the root to save result')

# backtest
parser.add_argument('--label_range', type=int,  default=10, help='the ratio of stop ret')
parser.add_argument('--cost_ratio', type=float,  default=0.001, help='the ratio of cost')
parser.add_argument('--money_init', type=float,  default=20000, help='the money of backtest')
parser.add_argument('--hold_num', type=int,  default=5, help='the ratio of stop ret')
parser.add_argument('--open_thred', type=float,  default=0.8, help='the ratio of stop ret')
parser.add_argument('--label_ret', type=float,  default=0.05, help='the ratio of stop ret')

parser.add_argument('--send_email', type=bool,  default=True, help='the ratio of stop ret')

args = parser.parse_args()
args.feature_root = r'data/cmodty/my_feature/feature_data'
args.label_root = r'data/stock_data/consentrate_daily_price'
args.feature_list = os.listdir(args.feature_root)
args.result_root = r'result/reg_real'
args.result_root = os.path.join(args.result_root, str(args.label_range)) 
if not os.path.exists(args.result_root):
    os.makedirs(args.result_root)


if is_trade_day():
    O = Pos_make_rank_thred_open(args)
    O.pos_make()
